<!-- templates/register.html -->
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>注册 - 毕业设计管理系统</title>
   <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<style>
        body {
            background: linear-gradient(to right, #f8f9fa, #e9ecef);
            display: flex;
            align-items: center;
            justify-content: center;
            height: 100vh;
            margin: 0;
        }
        .login-card {
            width: 100%;
            max-width: 450px;
            padding: 2rem;
            border-radius: 1rem;
            box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.1);
            background-color: white;
        }
        .form-control:focus {
            box-shadow: none;
            border-color: #007bff;
        }
        .btn-primary {
            background-color: #007bff;
            border-color: #007bff;
        }
        .btn-primary:hover {
            background-color: #0056b3;
        }
    </style>
<body>
<div class="login-card ">
    <h3 class="text-center mb-4">用户注册</h3>

    {% if error %}
    <div class="alert alert-danger alert-dismissible fade show" role="alert">
        {{ error }}
        <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
    </div>
    {% endif %}

    <form method="post" action="{% url 'register' %}">
        {% csrf_token %}
        <div class="mb-3">
            <label for="username" class="form-label">用户名</label>
            <input type="text" name="username" class="form-control" id="username" required>
        </div>
        <div class="mb-3">
            <label for="password" class="form-label">密码</label>
            <input type="password" name="password" class="form-control" id="password" required>
        </div>
        <div class="mb-3">
            <label for="confirm_password" class="form-label">确认密码</label>
            <input type="password" name="confirm_password" class="form-control" id="confirm_password" required>
        </div>
        <div class="mb-3">
            <label for="email" class="form-label">邮箱</label>
            <input type="email" name="email" class="form-control" id="email" required>
        </div>
        <div class="mb-3">
            <label for="phone" class="form-label">手机号</label>
            <input type="text" name="phone" class="form-control" id="phone" required>
        </div>
        
        <div class="mb-3">
            <label for="role" class="form-label">角色</label>
            <select name="role" class="form-select" id="role" required>
                <option value="student">学生</option>
                <option value="teacher">教师</option>
                <option value="admin">管理员</option>
            </select>
        </div>
        <div class="d-grid gap-2">
            <button type="submit" class="btn btn-primary">注册</button>
        </div>
    </form>

    <p class="mt-3 text-center">
        已有账号？<a href="{% url 'login' %}">立即登录</a>
    </p>
</div>
</body>

</html>
